package praktikum_I.blatt_II.aufgabe1;

/**
 * Created with IntelliJ IDEA.
 * User: mizus
 * Date: 22.10.13
 * Time: 12:48
 * To change this template use File | Settings | File Templates.
 */
public class Point {

    private int x,y;
    private double value;

    ///////////////////////
    // Konstruktor     ///
    ////////////   //////

    public Point(int x, int y){
        this.x = x;
        this.y = y;
    }

    public Point(int m, int n, double aValue){
        this.x = m;
        this.y = n;
        value = aValue;
    }


    public void setValue(double aValue){
        value = aValue;
    }

    public double getValue(){
        return value;
    }

    public int getX() {
        return x;
    }

    public void setX(int n) {
        this.x = n;
    }

    public int getY() {
        return y;
    }

    public void setY(int m) {
        this.y = m;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Point)) return false;

        Point point = (Point) o;

        if (x != point.x) return false;
        if (y != point.y) return false;
        if (value != point.value) return false;

        return true;
    }


    public boolean contain(Point point){
        return this.getX() == point.getX() && this.getY() == point.getY();
    }


    @Override
    public int hashCode() {
        int result = x;
        result = 31 * result + y;
        return result;
    }

    @Override
    public String toString() {
        return "Point{" +
                "x=" + x +
                ", y=" + y +
                ", value= " + value +
                '}';
    }
}
